from math import sqrt, floor
largest=0
n=600851475143
sqrtn=sqrt(n)
for i in range(2,int(floor(sqrtn))):
	if n%i==0:
		if i>largest: largest=i
		n=n/i
print largest